"""
数据库配置
"""
from typing import Dict, Any


class DBConfig:
    """
    数据库配置类
    """
    DB_TYPES = {
        "mysql": "MySQL 数据库",
        "postgres": "PostgreSQL 数据库",
        "sqlite": "SQLite 数据库"
    }

    DEFAULT_CONNECTION_PARAMS = {
        "mysql": {
            "host": "localhost",
            "port": 3306,
            "username": "root",
            "password": "",
            "database": "test_db"
        },
        "postgres": {
            "host": "localhost",
            "port": 5432,
            "username": "postgres",
            "password": "",
            "database": "test_db"
        },
        "sqlite": {
            "database": ":memory:"
        }
    }

    @classmethod
    def get_db_types(cls) -> Dict[str, str]:
        """
        获取数据库类型
        """
        return cls.DB_TYPES

    @classmethod
    def get_default_connection_params(cls, db_type: str) -> Dict[str, Any]:
        """
        获取默认连接参数
        """
        return cls.DEFAULT_CONNECTION_PARAMS.get(db_type, {})